package com.cinema.model;

import java.time.LocalDate;
import java.util.List;

public class Movie {
    private String movieId;
    private String title;
    private String director;
    private List<String> actors;
    private String description;
    private int duration; // 分钟
    private double rating; // 0-10分
    private boolean isShowing;
    private LocalDate releaseDate;

    public Movie(String movieId, String title, String director, List<String> actors,
                 String description, int duration, double rating) {
        this.movieId = movieId;
        this.title = title;
        this.director = director;
        this.actors = actors;
        this.description = description;
        this.duration = duration;
        this.rating = rating;
        this.isShowing = true;
        this.releaseDate = LocalDate.now();
    }

    // Getters and Setters
    public String getMovieId() { return movieId; }
    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }
    public String getDirector() { return director; }
    public void setDirector(String director) { this.director = director; }
    public List<String> getActors() { return actors; }
    public void setActors(List<String> actors) { this.actors = actors; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public int getDuration() { return duration; }
    public void setDuration(int duration) { this.duration = duration; }
    public double getRating() { return rating; }
    public void setRating(double rating) { this.rating = rating; }
    public boolean isShowing() { return isShowing; }
    public void setShowing(boolean showing) { isShowing = showing; }
    public LocalDate getReleaseDate() { return releaseDate; }

    @Override
    public String toString() {
        return String.format("《%s》 导演：%s 主演：%s 时长：%d分钟 评分：%.1f",
                title, director, String.join(",", actors), duration, rating);
    }
}
